package com.system.consultationroom.controller;

import com.system.consultationroom.bean.ConsultationRoom;
import com.system.consultationroom.bean.OptionBean;
import com.system.consultationroom.bean.OptionsBean;
import com.system.consultationroom.service.ConsultationRoomService;
import com.system.consultationroom.vo.ConsulationRoomItemVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * @className: ConsultationRoomController
 * @description: 诊室微服务控制类
 * @author: Li Chuanwei
 * @date: 2023/11/30 15:40
 * @Company: Copyright [日期] by [作者或个人]
 **/

@RestController
@RequestMapping("/consultationRoom")
public class ConsultationRoomController {
    @Autowired
    private ConsultationRoomService consultationRoomService;

    @PostMapping("/save")
    public boolean saveHandle(@RequestBody ConsultationRoom consultationRoom){
        return consultationRoomService.saveConsultationRoom(consultationRoom);
    }

    @DeleteMapping("/del/{id}")
    public boolean deleteHandle(@PathVariable("id") int id){
        return consultationRoomService.removeConsultationRoomById(id);
    }

    @PutMapping("/update")
    public boolean updateHandle(@RequestBody ConsultationRoom consultationRoom){
        return consultationRoomService.modifyConsultationRoom(consultationRoom);
    }

    @GetMapping("/get/{id}")
    public ConsultationRoom getHandle(@PathVariable("id") int id){
        return consultationRoomService.getConsultationRoomById(id);
    }

    @GetMapping("/get/list")
    public List<ConsultationRoom> listHandle(){
        return consultationRoomService.listAllConsultationRooms();
    }

    @GetMapping("/get/listByDepartID/{departId}")
    public List<ConsulationRoomItemVO> getListByDepartID(@PathVariable("departId") int departId){
        return consultationRoomService.getConsulationRoomItemVO(departId);
    }

    @GetMapping("/get/consultationRoomOptions")
    public OptionsBean<OptionBean>  getOptioins(){
        return consultationRoomService.getConsulationRoomOptions();
    }

}
